package com.iris.live.services.data.models;

import com.fasterxml.jackson.annotation.JsonProperty;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by xin on 2016/7/11.
 */
@SuppressWarnings("JpaDataSourceORMInspection")
@Entity
@Table(name = "LSH调研信息表", schema = "sg_lsh", catalog = "")
public class Lsh调研信息表Model {
    private Integer 调研编号;
    private Timestamp 更新时间;

    @Id
    @Column(name = "调研编号")
    @JsonProperty("调研编号")
    public Integer get调研编号() {
        return 调研编号;
    }

    public void set调研编号(Integer 调研编号) {
        this.调研编号 = 调研编号;
    }

    @Basic
    @Column(name = "更新时间")
    @JsonProperty("更新时间")
    public Timestamp get更新时间() {
        return 更新时间;
    }

    public void set更新时间(Timestamp 更新时间) {
        this.更新时间 = 更新时间;
    }

    @PrePersist
    @PreUpdate
    public void onPreUpdate() {
        this.set更新时间(new Timestamp(System.currentTimeMillis()));
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Lsh调研信息表Model that = (Lsh调研信息表Model) o;

        if (调研编号 != null ? !调研编号.equals(that.调研编号) : that.调研编号 != null) return false;
        if (更新时间 != null ? !更新时间.equals(that.更新时间) : that.更新时间 != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (调研编号 != null ? 调研编号.hashCode() : 0);
        result = 31 * result + (更新时间 != null ? 更新时间.hashCode() : 0);
        return result;
    }
}
